package com.iflytek.iot.redis.sharding.core;

import java.util.List;
import java.util.function.Consumer;
import java.util.function.Function;

/**
 * @author ZuRun
 * @date 2020/2/26 17:31:15
 */
public interface IRedisShardingFactory<T> {

    List<T> getRedisClients(IRedisGroup group);

    List<T> getRedisClients();

    T getRedisClient(String key);

    T getRedisClient(IRedisGroup group, String key);

    void execute(String key, Consumer<T> resourceConsumer);

    void execute(IRedisGroup group, String key, Consumer<T> resourceConsumer);

    <R> R execute(String key, Function<T, R> function);

    <R> R execute(IRedisGroup group, String key, Function<T, R> function);
}
